
const fs = require('fs')
module.exports = {
    clearfolder: function() {
            const files = fs.readdirSync('./public/cacheimg');
            files.forEach(file => {
                const filePath = `./public/cacheimg/${file}`;
                const stats = fs.statSync(filePath);
                if (stats.isDirectory()) {
                    emptyDir(filePath);
                } else {
                    fs.unlinkSync(filePath);
                    // console.log(`删除${file}文件成功`);
                }
            });
    },
    movefolder:function (name) {
        fs.renameSync(`./public/cacheimg/${name}`,`./public/image/${name}`)
    }
}

